﻿@{
    Layout = null;
}
<div ng-init="init(answer)">
    <div>
        <div class="col-md-1 votes-hldr" ng-hide="editing">
            <span class="item up-vote glyphicon glyphicon-circle-arrow-up" ng-click="voteAction('VoteUp',answer)"></span>
            <span class="item vote-count">{{answer.SupportCnt - answer.OpposeCnt}}</span>
            <span class="item down-vote glyphicon glyphicon-circle-arrow-down" ng-click="voteAction('VoteDown',answer)"></span>
        </div>
        <div class="col-md-11">
            <pagedown-viewer content="answer.Content" ng-hide="editing" class="body"></pagedown-viewer>
            <pagedown-editor content="answer.Content" ng-show="editing" class="body"></pagedown-editor>

            <!--数据验证错误显示-->
            <div class="validation-errors" ng-show="answer.validationErrors && answer.validationErrors.length != 0">
                <p class="text-danger">Please correct the following errors and submit again</p>
                <ul>
                    <li ng-repeat="err in answer.validationErrors" class="text-danger">{{err.Value[0]}}</li>
                </ul>
            </div>
            <!--end-->

            <div ng-show="serverError" class="text-danger">
                An error occured while processing your request. Pls try again in sometime.
            </div>

            <div>
                <div class="row col-md-12 actions">
                    <div ng-show="editing" class="pull-left">
                        <button class="btn btn-primary" ng-click="saveChanges(answer)">保存</button>
                        <button class="btn btn-default" ng-click="editCancel(answer)">取消</button>
                    </div>
                    <div ng-hide="editing" class="pull-left">
                        <button class="btn btn-default" ng-click="enableEdit(answer)">编辑</button>
                        <button class="btn btn-primary">回复</button>
                    </div>
                </div>

                <!--执行成功提示-->
                <div class="row col-md-12 pull-left">
                    <div class="alert alert-success" ng-show="answer.successOnSave">
                        Question has been saved/updated successfully.
                    </div>
                </div>
                <!--end-->
            </div>
        </div>
    </div>
</div>